package com.nobody.facepk.service;

import java.io.Serializable;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.trg.dao.hibernate.GeneralDAO;
import com.trg.search.ISearch;
import com.trg.search.Search;
import com.trg.search.SearchResult;

@Service
public class GeneralDaoService {
	protected GeneralDAO generalDao;
	
	@Transactional(readOnly=true)
	public int count(ISearch arg0) {
		return this.generalDao.count(arg0);
	}

	@Transactional(readOnly=true)
	public <T> T find(Class<T> arg0, Serializable arg1) {
		return this.generalDao.find(arg0, arg1);
	}

	@Transactional(readOnly=true)
	public <T> List<T> findAll(Class<T> arg0) {
		return this.generalDao.findAll(arg0);
	}

	@Transactional(readOnly=true)
	public void refresh(Object... arg0) {
		this.generalDao.refresh(arg0);
	}

	@Transactional(readOnly=false)
	public void remove(Object... arg0) {
		this.generalDao.remove(arg0);
	}

	@Transactional(readOnly=false)
	public boolean remove(Object arg0) {
		return this.generalDao.remove(arg0);
	}

	@Transactional(readOnly=false)
	public boolean removeById(Class<?> arg0, Serializable arg1) {
		return this.generalDao.removeById(arg0, arg1);
	}

	@Transactional(readOnly=false)
	public void removeByIds(Class<?> arg0, Serializable... arg1) {
		this.generalDao.removeByIds(arg0, arg1);
	}

	@Transactional(readOnly=false)
	public boolean[] save(Object... arg0) {
		return this.generalDao.save(arg0);
	}

	@Transactional(readOnly=false)
	public boolean save(Object arg0) {
		return this.generalDao.save(arg0);
	}

	@Transactional(readOnly=true)
	public List search(ISearch arg0) {
		return this.generalDao.search(arg0);
	}

	@Transactional(readOnly=true)
	public SearchResult searchAndCount(Search arg0) {
		return this.generalDao.searchAndCount(arg0);
	}

	@Transactional(readOnly=true)
	public Object searchUnique(ISearch arg0) {
		return this.generalDao.searchUnique(arg0);
	}
	
	@Autowired
	public void setGeneralDao(GeneralDAO generalDao) {
		this.generalDao = generalDao;
	}
}
